<template>
    <div style="margin-left:15px;">
        <template v-for="(cage, cageIndex) in sameCageList">
            <h1 :key="'h1_cageIndex_' + cageIndex">鸡兔同笼
                <i v-if="cageIndex == sameCageList.length - 1" class="el-icon-document-copy" style="margin-left: 10px;cursor:pointer" @click="copySameCageCmp"></i>
                <i v-if="sameCageList.length > 1 && cageIndex == sameCageList.length - 1" class="el-icon-delete" style="margin-left: 10px;cursor:pointer"  @click="delSameCageCmp(cageIndex)"></i>
            </h1>
            <same_cage :param="cage" :key="'cageIndex_' + cageIndex"></same_cage>
            <hr :key="'hr_cageIndex_' + cageIndex"/>
        </template>
        <template v-for="(translation, translationIndex) in translationList">
            <div :key="'div_translationIndex_' + translationIndex" v-if="translation.show">
                translation.show:{{translation.show}}
                <h1 :key="'h1_translationIndex_' + translationIndex">平移
                    <i v-if="translationIndex == translationList.length - 1" class="el-icon-document-copy" style="margin-left: 10px;cursor:pointer" @click="copyTranslationCmp"></i>
                    <i v-if="translationList.length > 1 && translationIndex == translationList.length - 1" class="el-icon-delete" style="margin-left: 10px;cursor:pointer"  @click="delTranslationCmp(translationIndex)"></i>
                </h1>
                <pingyi :param="translation" :key="'translationIndex_' + translationIndex"></pingyi>
                <hr :key="'hr_translationIndex_' + translationIndex"/>
            </div>
        </template>
    </div>
</template>

<script>
    import pingyi from './pingyi'
    import same_cage from './same_cage'
    export default {
        name: "graph",
        components: {pingyi, same_cage},
        data() {
            return {
                sameCageList: [{}],
                translationList: [{}],
            }
        },
        methods: {
            copySameCageCmp() {
                this.sameCageList.push({})
            },
            delSameCageCmp(index) {
                this.sameCageList.splice(index, 1)
            },
            copyTranslationCmp() {
                this.translationList.push({})
            },
            delTranslationCmp(index) {
                this.translationList.splice(index, 1)
            },
        }
    }
</script>

<style scoped>

</style>
